<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Gets and sort messages</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.imap-sort" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imap_sort</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">imap_sort</span> &mdash; <span class="dc-title">Gets and sort messages</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imap-sort-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imap_sort</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$imap_stream</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$criteria</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$reverse</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$search_criteria</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$charset</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
  ]]] ) : <span class="type">array</span></div>

  <p class="para rdfs-comment">
   Gets and sorts message numbers by the given parameters.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imap-sort-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    <dt>
<code class="parameter">
imap_stream</code></dt>
<dd>
<p class="para">由 <span class="function"><a href="imap_open.html" class="function">imap_open()</a></span> 返回的 IMAP 流。</p></dd>

    
     <dt>
<code class="parameter">criteria</code></dt>

     <dd>

      <p class="para">
       Criteria can be one (and only one) of the following:
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          <strong><code>SORTDATE</code></strong> - message Date
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>SORTARRIVAL</code></strong> - arrival date
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>SORTFROM</code></strong> - mailbox in first From address
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>SORTSUBJECT</code></strong> - message subject
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>SORTTO</code></strong> - mailbox in first To address
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>SORTCC</code></strong> - mailbox in first cc address
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>SORTSIZE</code></strong> - size of message in octets
         </span>
        </li>
       </ul>
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">reverse</code></dt>

     <dd>

      <p class="para">
       Set this to 1 for reverse sorting
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">options</code></dt>

     <dd>

      <p class="para">
       The <code class="parameter">options</code> are a bitmask of one or more of the
       following:
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          <strong><code>SE_UID</code></strong> - Return UIDs instead of sequence numbers
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>SE_NOPREFETCH</code></strong> - Don&#039;t prefetch searched messages
         </span>
        </li>
       </ul>
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">search_criteria</code></dt>

     <dd>

      <p class="para">
       IMAP2-format search criteria string. For details see
       <span class="function"><a href="imap_search.html" class="function">imap_search()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">charset</code></dt>

     <dd>

      <p class="para">
       MIME character set to use when sorting strings.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imap-sort-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an array of message numbers sorted by the given
   parameters.
  </p>
 </div>

</div></div></div></body></html>